<?php 

Class videoModel extends AppModel
{
	

	public function ad_list($page=1)
	{
		$listPage=array('data'=>'','pageLink'=>'');
		
		$result=$this->show_page("SELECT title,id,video_url,add_time FROM ".$this->table('video')." ORDER BY id DESC",$page);
		$listPage['pagelink']=$result['page'];
		$listPage['data']=$result['result'];
		
		
		return $listPage;
	}
	public function comment_list($page=1)
	{
		$listPage=array('data'=>'','pageLink'=>'');
	   	$sql = "SELECT vc.status,vc.id,vc.wxid,vc.content,vc.add_time,u.nickname FROM ".$this->table('video_comment')." as vc".
	   			" LEFT JOIN ".$this->table('wxusers')." as u ON u.wxid = vc.wxid ".
	   	 		" ORDER BY status ASC,id DESC ";
		$result=$this->show_page($sql,$page);
		$listPage['pagelink']=$result['page'];
		$listPage['data']=$result['result'];
	
	
		return $listPage;
	}
	public function get_video($id)
	{
		$sql="SELECT a.* FROM ".$this->table('video')."  as a WHERE a.id = '".$id."'";
			
		$result=$this->getRow($sql);
	
		if($result)
		{
			return $result;
		}
		else
		{
			return $result=array();
		}
	}
	

}